// basic string conversion functions
// tostring(double)
// tostring(int)
//
// I'm not happy with hardcoding the buffer size, but if the ints and doubles are limited to a certain number of digits, this *should* work, right?

#include <string>
#include <iostream>
using namespace std;


string tostring(int theInt) {
	//long ints can have 11 characters
	int NUMCHARS = 11;
	char tmpstr[NUMCHARS];
	string strRetVal;
	sprintf(tmpstr,"%i",theInt);
	strRetVal = tmpstr;

	//cout << "CONVERTING INT2STR\t" << theInt << "\t";
	return(strRetVal);
}

string tostring(double theDbl) {
	//doubles have ~ 15 digits (http://www.cplusplus.com/doc/tutorial/variables/) so using 20
	int NUMCHARS = 20;
	char tmpstr[NUMCHARS];
	string strRetVal;
	sprintf(tmpstr,"%g",theDbl);
	strRetVal = tmpstr;

	//cout << "CONVERTING DBL2STR\t" << theDbl << "\t";
	return(strRetVal);
}

